home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / game / wins1726.zip / DIALOG2.C < prev    next >
C/C++ Source or Header  |  1992-06-06  |  59KB  |  1,669 lines

  1. /*
  2.  
  3.     various dialog-box code - more in DIALOG.C
  4.  
  5. */
  6.  
  7. #include "windows.h"
  8. #include "winfract.h"
  9. #include "dialog2.h"
  10. #include "fractint.h"
  11. #include "fractype.h"
  12. #include <math.h>
  13. #include <stdio.h>
  14. #include "profile.h"
  15.  
  16. extern HWND hwnd;                               /* handle to main window */
  17. extern char szHelpFileName[];                   /* Help file name*/
  18.  
  19. extern BOOL zoomflag;                /* TRUE is a zoom-box selected */
  20.  
  21. extern char *win_choices[];
  22. extern int win_numchoices, win_choicemade;
  23. int CurrentFractal;
  24.  
  25. extern HANDLE hDibInfo;        /* handle to the Device-independent bitmap */
  26. extern LPBITMAPINFO pDibInfo;        /* pointer to the DIB info */
  27.  
  28. extern int time_to_restart;                               /* time to restart?  */
  29. extern int time_to_reinit;                /* time to reinit? */
  30. extern int time_to_cycle;                               /* time to cycle? */
  31.  
  32. extern int xdots, ydots, colors, maxiter;
  33. extern int ytop, ybottom, xleft, xright;
  34. extern double xxmin, xxmax, yymin, yymax;
  35. extern int fractype;
  36. extern int calc_status;
  37. extern double param[4];
  38. extern int bailout;
  39.  
  40. extern int inside, outside, usr_biomorph, decomp, debugflag;
  41. extern int usr_stdcalcmode, usr_floatflag;
  42. extern    int    invert;     /* non-zero if inversion active */
  43. extern    double    inversion[3];    /* radius, xcenter, ycenter */
  44. extern int numtrigfn;
  45.  
  46. extern int LogFlag, fillcolor;
  47.  
  48. int win_temp1, win_temp2, win_temp3, win_temp4;
  49.  
  50. int numparams,numtrig;
  51. static char *trg[] = {"First Function","Second Function",
  52.               "Third Function","Fourth Function"};
  53. static int paramt[] = {ID_FRACPARTX1, ID_FRACPARTX2,
  54.                        ID_FRACPARTX3, ID_FRACPARTX4,
  55.                        ID_FRACPARTX5, ID_FRACPARTX6 };
  56. static int paramv[] = {ID_FRACPARAM1, ID_FRACPARAM2,
  57.                        ID_FRACPARAM3, ID_FRACPARAM4,
  58.                        ID_FRACPARAM5, ID_FRACPARAM6, };
  59.  
  60. extern int win_release;
  61. extern char win_comment[];
  62.  
  63. extern char DialogTitle[];
  64.  
  65. double far win_oldprompts[20];
  66.  
  67. /****************************************************************************
  68.  
  69.     FUNCTION: About(HWND, unsigned, WORD, LONG)
  70.  
  71.     PURPOSE:  Processes messages for "About" dialog box
  72.  
  73.     MESSAGES:
  74.  
  75.         WM_INITDIALOG - initialize dialog box
  76.         WM_COMMAND    - Input received
  77.  
  78. ****************************************************************************/
  79.  
  80. BOOL FAR PASCAL About(hDlg, message, wParam, lParam)
  81. HWND hDlg;
  82. unsigned message;
  83. WORD wParam;
  84. LONG lParam;
  85. {
  86.  
  87. float temp;
  88. char tempname[40];
  89.  
  90.     switch (message) {
  91.  
  92.         case WM_INITDIALOG:
  93.             temp = win_release / 100.0;
  94.             sprintf(tempname,"Fractint for Windows - Vers %5.2f", temp);
  95.             SetDlgItemText(hDlg, ID_VERSION,tempname);
  96.             SetDlgItemText(hDlg, ID_COMMENT,win_comment);
  97.             return (TRUE);
  98.  
  99.         case WM_COMMAND:
  100.         if (wParam == IDOK
  101.                 || wParam == IDCANCEL) {
  102.                 EndDialog(hDlg, TRUE);
  103.                 return (TRUE);
  104.             }
  105.             break;
  106.     }
  107.     return (FALSE);
  108. }
  109.  
  110. /****************************************************************************
  111.  
  112.     FUNCTION: Status(HWND, unsigned, WORD, LONG)
  113.  
  114.     PURPOSE:  Processes messages for "Status" dialog box
  115.  
  116.     MESSAGES:
  117.  
  118.         WM_INITDIALOG - initialize dialog box
  119.         WM_COMMAND    - Input received
  120.  
  121. ****************************************************************************/
  122.  
  123. BOOL FAR PASCAL Status(hDlg, message, wParam, lParam)
  124. HWND hDlg;
  125. unsigned message;
  126. WORD wParam;
  127. LONG lParam;
  128. {
  129. char tempstring[100];
  130.     switch (message) {
  131.  
  132.         case WM_INITDIALOG:
  133.             sprintf(tempstring,"fractal type: ");
  134.             strcat(tempstring, fractalspecific[fractype].name);
  135.             if (calc_status == 1)
  136.                 strcat(tempstring,"    (still being calculated)");
  137.             else
  138.                 strcat(tempstring,"    (interrupted/completed)");
  139.             /* ##### */
  140.             SetDlgItemText(hDlg, IDS_LINE1,tempstring);
  141.             if(fractalspecific[fractype].param[0][0] == 0)
  142.                 tempstring[0] = 0;
  143.             else
  144.                 sprintf(tempstring,"%-30.30s   %14.10f",
  145.                     fractalspecific[fractype].param[0], param[0]);
  146.             SetDlgItemText(hDlg, IDS_LINE2,tempstring);
  147.             if(fractalspecific[fractype].param[1][0] == 0)
  148.                 tempstring[0] = 0;
  149.             else
  150.                 sprintf(tempstring,"%-30.30s   %14.10f",
  151.                     fractalspecific[fractype].param[1], param[1]);
  152.             SetDlgItemText(hDlg, IDS_LINE3,tempstring);
  153.             if(fractalspecific[fractype].param[2][0] == 0)
  154.                 tempstring[0] = 0;
  155.             else
  156.                 sprintf(tempstring,"%-30.30s   %14.10f",
  157.                     fractalspecific[fractype].param[2], param[2]);
  158.             SetDlgItemText(hDlg, IDS_LINE4,tempstring);
  159.             if(fractalspecific[fractype].param[3][0] == 0)
  160.                 tempstring[0] = 0;
  161.             else
  162.                 sprintf(tempstring,"%-30.30s   %14.10f",
  163.                     fractalspecific[fractype].param[3], param[3]);
  164.             SetDlgItemText(hDlg, IDS_LINE5,tempstring);
  165.             sprintf(tempstring,"Xmin:        %25.16f", xxmin);
  166.             SetDlgItemText(hDlg, IDS_LINE6,tempstring);
  167.             sprintf(tempstring,"Xmax:        %25.16f", xxmax);
  168.             SetDlgItemText(hDlg, IDS_LINE7,tempstring);
  169.             sprintf(tempstring,"Ymin:        %25.16f", yymin);
  170.             SetDlgItemText(hDlg, IDS_LINE8,tempstring);
  171.             sprintf(tempstring,"Ymax:        %25.16f", yymax);
  172.             SetDlgItemText(hDlg, IDS_LINE9,tempstring);
  173.             return (TRUE);
  174.  
  175.         case WM_COMMAND:
  176.         if (wParam == IDOK
  177.                 || wParam == IDCANCEL) {
  178.                 EndDialog(hDlg, TRUE);
  179.                 return (TRUE);
  180.             }
  181.             break;
  182.     }
  183.     return (FALSE);
  184. }
  185.  
  186. /****************************************************************************
  187.  
  188.     FUNCTION: SelectFractal(HWND, unsigned, WORD, LONG)
  189.  
  190.     PURPOSE: Initializes window data and registers window class
  191.  
  192. ****************************************************************************/
  193.  
  194. BOOL FAR PASCAL SelectFractal(hDlg, message, wParam, lParam)
  195. HWND hDlg;
  196. unsigned message;
  197. WORD wParam;
  198. LONG lParam;
  199. {
  200.  
  201.     int i;
  202.     int index;
  203.  
  204.     switch (message) {
  205.  
  206.         case WM_INITDIALOG:
  207.             SetDlgItemText(hDlg, ID_LISTTITLE, DialogTitle);
  208.             for (i = 0; i < win_numchoices; i++) 
  209.                 SendDlgItemMessage(hDlg, IDM_FRACTAL, LB_ADDSTRING,
  210.                     NULL, (LONG) (LPSTR) win_choices[i]);
  211.             SendDlgItemMessage(hDlg, IDM_FRACTAL, LB_SETCURSEL,
  212.                 win_choicemade, 0L);
  213.             return (TRUE);
  214.  
  215.         case WM_COMMAND:
  216.             switch (wParam) {
  217.  
  218.                 case IDOK:
  219. okay:           
  220.                     index=SendDlgItemMessage(hDlg, IDM_FRACTAL,
  221.                         LB_GETCURSEL, 0, 0L);
  222.                     if (index == LB_ERR) {
  223.                         MessageBox(hDlg, "No Choice selected",
  224.                             "Select From a List", MB_OK | MB_ICONEXCLAMATION);
  225.                         break;
  226.                         }
  227.                     win_choicemade = index;
  228.                     EndDialog(hDlg, 1);
  229.                     break;
  230.                   
  231.                 case IDCANCEL:
  232.                     win_choicemade = -1;
  233.                     EndDialog(hDlg, 0);
  234.                     break;
  235.                     
  236.                 case IDM_FRACTAL:
  237.                     switch (HIWORD(lParam)) {
  238.                         case LBN_SELCHANGE:
  239.                             index = SendDlgItemMessage(hDlg, IDM_FRACTAL,
  240.                                 LB_GETCURSEL, 0, 0L);
  241.                             if (index == LB_ERR)
  242.                                 break;
  243.                             break;
  244.                          
  245.                        case LBN_DBLCLK:
  246.                             goto okay;
  247.  
  248.                     }
  249.             return (TRUE);
  250.                 }
  251.  
  252.         }
  253.     return (FALSE);
  254. }
  255.  
  256. /****************************************************************************
  257.  
  258.     FUNCTION: SelectFracParams(HWND, unsigned, WORD, LONG)
  259.  
  260.     PURPOSE: Initializes window data and registers window class
  261.  
  262. ****************************************************************************/
  263.  
  264. BOOL FAR PASCAL SelectFracParams(hDlg, message, wParam, lParam)
  265. HWND hDlg;
  266. unsigned message;
  267. WORD wParam;
  268. LONG lParam;
  269. {
  270.  
  271.     int i, j;
  272.     char temp[30];
  273.  
  274.     switch (message) {
  275.  
  276.         case WM_INITDIALOG:
  277.                 win_temp1 = CurrentFractal;
  278.             SetDlgItemText(hDlg, ID_FRACNAME,   fractalspecific[win_temp1].name);
  279.                 for (numparams = 0; numparams < 4; numparams++)
  280.                     if (fractalspecific[win_temp1].param[numparams][0] == 0)
  281.                         break;
  282.                 numtrig = (fractalspecific[win_temp1].flags >> 6) & 7;
  283.                 if (numparams+numtrig > 6) numparams = 6 - numtrig;
  284.                 for (i = 0; i < 6; i++) {
  285.                     temp[0] = 0;
  286.                     if (i < numparams)
  287.                         sprintf(temp,"%f",param[i]);
  288.                     SetDlgItemText(hDlg, paramv[i], temp);
  289.                     SetDlgItemText(hDlg, paramt[i],"(n/a)");
  290.                     if (i < numparams)
  291.                        SetDlgItemText(hDlg, paramt[i], fractalspecific[win_temp1].param[i]);
  292.                     }
  293.                for(i=0; i<numtrig; i++) {
  294.                     SetDlgItemText(hDlg, paramt[i+numparams], trg[i]);
  295.                     SetDlgItemText(hDlg, paramv[i+numparams],
  296.                         trigfn[trigndx[i]].name);
  297.                     }
  298.                 sprintf(temp,"%d",bailout);
  299.             SetDlgItemText(hDlg, ID_BAILOUT,   temp);
  300.                 sprintf(temp,"%.12f",xxmin);
  301.             SetDlgItemText(hDlg, ID_FRACXMIN,   temp);
  302.                 sprintf(temp,"%.12f",xxmax);
  303.             SetDlgItemText(hDlg, ID_FRACXMAX,   temp);
  304.                 sprintf(temp,"%.12f",yymin);
  305.             SetDlgItemText(hDlg, ID_FRACYMIN,   temp);
  306.                 sprintf(temp,"%.12f",yymax);
  307.             SetDlgItemText(hDlg, ID_FRACYMAX,   temp);
  308.                 return (TRUE);
  309.  
  310.         case WM_COMMAND:
  311.             switch (wParam) {
  312.  
  313.                 case IDOK:
  314.                     {
  315.                     for (i = 0; i < numtrig; i++) {
  316.                         GetDlgItemText(hDlg, paramv[i+numparams], temp, 10);
  317.                         temp[6] = 0;
  318.                         for (j = 0; j <= 6; j++)
  319.                             if(temp[j] == ' ') temp[j] = 0;
  320.                         strlwr(temp);
  321.                         for(j=0;j<numtrigfn;j++)
  322.                             if(strcmp(temp,trigfn[j].name)==0)
  323.                                 break;
  324.                         if (j >= numtrigfn) {
  325.                             char oops[80];
  326.                             sprintf(oops, "Trig param %d, '%s' is not a valid trig function\n", i+1, temp);
  327.                             strcat(oops, "Try sin, cos, tan, cotan, sinh, etc.");
  328.                             stopmsg(0,oops);
  329.                             break;
  330.                             }
  331.                         }
  332.                         if (i != numtrig) break;
  333.                     }
  334.                     for (i = 0; i < numparams; i++) {
  335.                         GetDlgItemText(hDlg, paramv[i], temp, 20);
  336.                         param[i] = atof(temp);
  337.                         }
  338.                     for (i = 0; i < numtrig; i++) {
  339.                         GetDlgItemText(hDlg, paramv[i+numparams], temp, 10);
  340.                         temp[6] = 0;
  341.                         for (j = 0; j <= 6; j++)
  342.                             if (temp[j] == 32) temp[j] = 0;
  343.                         set_trig_array(i, temp);
  344.                         }
  345.             GetDlgItemText(hDlg, ID_BAILOUT   , temp, 10);
  346.             bailout = atof(temp);
  347.             GetDlgItemText(hDlg, ID_FRACXMIN  , temp, 20);
  348.             xxmin = atof(temp);
  349.             GetDlgItemText(hDlg, ID_FRACXMAX  , temp, 20);
  350.             xxmax = atof(temp);
  351.             GetDlgItemText(hDlg, ID_FRACYMIN  , temp, 20);
  352.             yymin = atof(temp);
  353.             GetDlgItemText(hDlg, ID_FRACYMAX  , temp, 20);
  354.             yymax = atof(temp);
  355.                     invert = 0;
  356.                     inversion[0] = inversion[1] = inversion[2] = 0;
  357.                     fractype = CurrentFractal;
  358.                     EndDialog(hDlg, 1);
  359.                     break;
  360.                     
  361.                   
  362.                 case IDCANCEL:
  363.                     EndDialog(hDlg, 0);
  364.                     break;
  365.  
  366.                 }
  367.         
  368.         }
  369.     return (FALSE);
  370. }
  371.  
  372. /****************************************************************************
  373.  
  374.     FUNCTION: SelectImage(HWND, unsigned, WORD, LONG)
  375.  
  376.     PURPOSE: Initializes window data and registers window class
  377.  
  378. ****************************************************************************/
  379.  
  380. BOOL FAR PASCAL SelectImage(hDlg, message, wParam, lParam)
  381. HWND hDlg;
  382. unsigned message;
  383. WORD wParam;
  384. LONG lParam;
  385. {
  386.  
  387.     int i;
  388.     char temp[15];
  389.  
  390.     switch (message) {
  391.  
  392.         case WM_INITDIALOG:
  393.             win_temp1 = colors;
  394.             if (win_temp1 == 2)
  395.                 CheckDlgButton(hDlg, ID_ICOLORS1, 1);
  396.             else if (win_temp1 == 16)
  397.                 CheckDlgButton(hDlg, ID_ICOLORS2, 1);
  398.             else
  399.                 CheckDlgButton(hDlg, ID_ICOLORS3, 1);
  400.             sprintf(temp,"%d",xdots);
  401.         SetDlgItemText(hDlg, ID_ISIZEX, temp);
  402.             sprintf(temp,"%d",ydots);
  403.         SetDlgItemText(hDlg, ID_ISIZEY, temp);
  404.         i = ID_ISIZE7;
  405.         if (xdots ==  200 && ydots == 150) i = ID_ISIZE1;
  406.         if (xdots ==  320 && ydots == 200) i = ID_ISIZE2;
  407.         if (xdots ==  640 && ydots == 350) i = ID_ISIZE3;
  408.         if (xdots ==  640 && ydots == 480) i = ID_ISIZE4;
  409.         if (xdots ==  800 && ydots == 600) i = ID_ISIZE5;
  410.         if (xdots == 1024 && ydots == 768) i = ID_ISIZE6;
  411.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, i);
  412.             return (TRUE);
  413.  
  414.         case WM_COMMAND:
  415.             switch (wParam) {
  416.  
  417.                 case IDOK:
  418.                     /* retrieve and validate the results */
  419.             GetDlgItemText(hDlg, ID_ISIZEX, temp, 10);
  420.             xdots = atoi(temp);
  421.             if (xdots < 50) xdots = 50;
  422.             if (xdots > 2048) xdots = 2048;
  423.             GetDlgItemText(hDlg, ID_ISIZEY, temp, 10);
  424.             ydots = atoi(temp);
  425.             if (ydots < 50) ydots = 50;
  426.             if (ydots > 2048) ydots = 2048;
  427.                     colors = win_temp1;
  428.                     /* allocate and lock a pixel array for the bitmap */
  429.                     /* problem, here - can't just RETURN!!! */
  430.                     tryagain:
  431.                     if (!clear_screen(0)) {
  432.                         MessageBox(hDlg, "Not Enough Memory for that sized Image",
  433.                             NULL, MB_OK | MB_ICONHAND);
  434.                         xdots = ydots = 100;
  435.                         goto tryagain;
  436.                         };
  437.                     ytop    = 0;        /* reset the zoom-box */
  438.                     ybottom = ydots-1;
  439.                     xleft   = 0;
  440.                     xright  = xdots-1;
  441.                     set_win_offset();
  442.                     zoomflag = TRUE;
  443.                     time_to_restart = 1;
  444.  
  445.                     ProgStr = Winfract;
  446.                     SaveIntParam(ImageWidthStr, xdots);
  447.                     SaveIntParam(ImageHeightStr, ydots);
  448.  
  449.                     EndDialog(hDlg, 1);
  450.                     break;
  451.                   
  452.                 case IDCANCEL:
  453.                     EndDialog(hDlg, 0);
  454.                     break;
  455.  
  456.                 case ID_ISIZE1:
  457.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE1);
  458.             SetDlgItemInt(hDlg, ID_ISIZEX, 200, TRUE);
  459.             SetDlgItemInt(hDlg, ID_ISIZEY, 150, TRUE);
  460.                     break;
  461.  
  462.                 case ID_ISIZE2:
  463.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE2);
  464.             SetDlgItemInt(hDlg, ID_ISIZEX, 320, TRUE);
  465.             SetDlgItemInt(hDlg, ID_ISIZEY, 200, TRUE);
  466.                     break;
  467.  
  468.                 case ID_ISIZE3:
  469.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE3);
  470.             SetDlgItemInt(hDlg, ID_ISIZEX, 640, TRUE);
  471.             SetDlgItemInt(hDlg, ID_ISIZEY, 350, TRUE);
  472.                     break;
  473.  
  474.                 case ID_ISIZE4:
  475.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE4);
  476.             SetDlgItemInt(hDlg, ID_ISIZEX, 640, TRUE);
  477.             SetDlgItemInt(hDlg, ID_ISIZEY, 480, TRUE);
  478.                     break;
  479.  
  480.                 case ID_ISIZE5:
  481.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE5);
  482.             SetDlgItemInt(hDlg, ID_ISIZEX, 800, TRUE);
  483.             SetDlgItemInt(hDlg, ID_ISIZEY, 600, TRUE);
  484.                     break;
  485.  
  486.                 case ID_ISIZE6:
  487.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE6);
  488.             SetDlgItemInt(hDlg, ID_ISIZEX, 1024, TRUE);
  489.             SetDlgItemInt(hDlg, ID_ISIZEY, 768, TRUE);
  490.                     break;
  491.  
  492.                 case ID_ISIZE7:
  493.             CheckRadioButton(hDlg, ID_ISIZE1, ID_ISIZE7, ID_ISIZE7);
  494.                     break;
  495.  
  496.                 case ID_ICOLORS1:
  497.             CheckRadioButton(hDlg, ID_ICOLORS1, ID_ICOLORS3, ID_ICOLORS1);
  498.                     win_temp1 = 2;
  499.                     break;
  500.  
  501.                 case ID_ICOLORS2:
  502.             CheckRadioButton(hDlg, ID_ICOLORS1, ID_ICOLORS3, ID_ICOLORS2);
  503.                     win_temp1 = 16;
  504.                     break;
  505.  
  506.                 case ID_ICOLORS3:
  507.             CheckRadioButton(hDlg, ID_ICOLORS1, ID_ICOLORS3, ID_ICOLORS3);
  508.                     win_temp1 = 256;
  509.                     break;
  510.  
  511.                 }
  512.         
  513.         }
  514.     return (FALSE);
  515. }
  516.  
  517. /****************************************************************************
  518.  
  519.     FUNCTION: SelectDoodads(HWND, unsigned, WORD, LONG)
  520.  
  521.     PURPOSE: Initializes window data and registers window class
  522.  
  523. ****************************************************************************/
  524.  
  525. BOOL FAR PASCAL SelectDoodads(hDlg, message, wParam, lParam)
  526. HWND hDlg;
  527. unsigned message;
  528. WORD wParam;
  529. LONG lParam;
  530. {
  531.  
  532.     char temp[80];
  533.  
  534.     switch (message) {
  535.  
  536.         case WM_INITDIALOG:
  537.             win_temp1 = usr_floatflag;
  538.             win_temp2 = 0;
  539.             if (usr_stdcalcmode == '2') win_temp2 = 1;
  540.             if (usr_stdcalcmode == 'g') win_temp2 = 2;
  541.             if (usr_stdcalcmode == 'b') win_temp2 = 3;
  542.             if (usr_stdcalcmode == 't') win_temp2 = 4;
  543.             win_temp3 = 0;
  544.             if (inside == -1)    win_temp3 = 1;
  545.             if (inside == -59)   win_temp3 = 2;
  546.             if (inside == -60)   win_temp3 = 3;
  547.             if (inside == -61)   win_temp3 = 4;
  548.             if (inside == -100)  win_temp3 = 5;
  549.             if (inside == -101)  win_temp3 = 6;
  550.             win_temp4 = 0;
  551.             if (outside < 0 && outside > -6) win_temp4 = 0 - outside;
  552.             CheckDlgButton(hDlg, ID_PASS1+win_temp2,1);
  553.             CheckDlgButton(hDlg, ID_INSIDEC+win_temp3, 1);
  554.             CheckDlgButton(hDlg, ID_OUTSIDEN+win_temp4, 1);
  555.             if (win_temp1)
  556.                 CheckDlgButton(hDlg, ID_MATHF, 1);
  557.             else
  558.                 CheckDlgButton(hDlg, ID_MATHF, 0);
  559.             sprintf(temp,"%d",maxiter);
  560.         SetDlgItemText(hDlg, ID_MAXIT, temp);
  561.             sprintf(temp,"%d",usr_biomorph);
  562.         SetDlgItemText(hDlg, ID_BIOMORPH, temp);
  563.             sprintf(temp,"%d",LogFlag);
  564.         SetDlgItemText(hDlg, ID_LOGP, temp);
  565.             sprintf(temp,"%d",decomp);
  566.         SetDlgItemText(hDlg, ID_DECOMP, temp);
  567.             sprintf(temp,"%d",fillcolor);
  568.         SetDlgItemText(hDlg, ID_FILLC, temp);
  569.             sprintf(temp,"%d",max(inside,0));
  570.         SetDlgItemText(hDlg, ID_INSIDE, temp);
  571.             sprintf(temp,"%d",max(outside,0));
  572.         SetDlgItemText(hDlg, ID_OUTSIDE, temp);
  573.             return (TRUE);
  574.  
  575.         case WM_COMMAND:
  576.             switch (wParam) {
  577.  
  578.                 case IDOK:
  579.                     /* retrieve and validate the results */
  580.                     usr_stdcalcmode = '1';
  581.                     if (win_temp2 == 1) usr_stdcalcmode = '2';
  582.                     if (win_temp2 == 2) usr_stdcalcmode = 'g';
  583.                     if (win_temp2 == 3) usr_stdcalcmode = 'b';
  584.                     if (win_temp2 == 4) usr_stdcalcmode = 't';
  585.                     usr_floatflag = win_temp1;
  586.                     GetDlgItemText(hDlg, ID_MAXIT, temp, 10);
  587.                     maxiter = atoi(temp);
  588.                     if (maxiter < 10) maxiter = 10;
  589.                     if (maxiter > 32000) maxiter = 32000;
  590.                     GetDlgItemText(hDlg, ID_LOGP, temp, 10);
  591.                     LogFlag = atoi(temp);
  592.                     GetDlgItemText(hDlg, ID_BIOMORPH, temp, 10);
  593.                     usr_biomorph = atoi(temp);
  594.                     if (usr_biomorph < 0) usr_biomorph = -1;
  595.                     if (usr_biomorph >= colors) usr_biomorph = colors-1;
  596.                     GetDlgItemText(hDlg, ID_DECOMP, temp, 10);
  597.                     decomp = atoi(temp);
  598.                     if (decomp < 0) decomp = 0;
  599.                     if (decomp > 256) decomp = 256;
  600.                     GetDlgItemText(hDlg, ID_FILLC, temp, 10);
  601.                     fillcolor = atoi(temp);
  602.                     GetDlgItemText(hDlg, ID_INSIDE, temp, 10);
  603.                     inside = atoi(temp);
  604.                     if (inside < 0) inside = 0;
  605.                     if (inside >= colors) inside = colors-1;
  606.                     if (win_temp3 == 1) inside = -1;
  607.                     if (win_temp3 == 2) inside = -59;
  608.                     if (win_temp3 == 3) inside = -60;
  609.                     if (win_temp3 == 4) inside = -61;
  610.                     if (win_temp3 == 5) inside = -100;
  611.                     if (win_temp3 == 6) inside = -101;
  612.                     GetDlgItemText(hDlg, ID_OUTSIDE, temp, 10);
  613.                     outside = atoi(temp);
  614.                     if (outside < 0) outside = -1;
  615.                     if (outside >= colors) outside = colors-1;
  616.                     if (win_temp4 > 0) outside = 0 - win_temp4;
  617.                     time_to_restart = 1;
  618.                     EndDialog(hDlg, 1);
  619.                     break;
  620.                   
  621.                 case IDCANCEL:
  622.                     EndDialog(hDlg, 0);
  623.                     break;
  624.  
  625.                 case ID_PASS1:
  626.                 case ID_PASS2:
  627.                 case ID_PASSS:
  628.                 case ID_PASSB:
  629.                 case ID_PASST:
  630.                     win_temp2 = wParam - ID_PASS1;
  631.                     CheckRadioButton(hDlg, ID_PASS1, ID_PASST, wParam);
  632.                     break;
  633.  
  634.                 case ID_INSIDEC:
  635.                 case ID_INSIDEM:
  636.                 case ID_INSIDEZ:
  637.                 case ID_INSIDE60:
  638.                 case ID_INSIDE61:
  639.                 case ID_INSIDEE:
  640.                 case ID_INSIDES:
  641.                     win_temp3 = wParam - ID_INSIDEC;
  642.                     CheckRadioButton(hDlg, ID_INSIDEC, ID_INSIDES, wParam);
  643.                     break;
  644.  
  645.                 case ID_OUTSIDEN:
  646.                 case ID_OUTSIDEIT:
  647.                 case ID_OUTSIDER:
  648.                 case ID_OUTSIDEIM:
  649.                 case ID_OUTSIDEM:
  650.                 case ID_OUTSIDES:
  651.                     win_temp4 = wParam - ID_OUTSIDEN;
  652.                     CheckRadioButton(hDlg, ID_OUTSIDEN, ID_OUTSIDES, wParam);
  653.                     break;
  654.  
  655.                 case ID_MATHF:
  656.                     if (win_temp1 == 0)
  657.                         win_temp1 = 1;
  658.                     else
  659.                         win_temp1 = 0;
  660.                     CheckDlgButton(hDlg, ID_MATHF, win_temp1);
  661.                     break;
  662.  
  663.                 }
  664.         
  665.         }
  666.     return (FALSE);
  667. }
  668.  
  669. /****************************************************************************
  670.  
  671.     FUNCTION: SelectExtended(HWND, unsigned, WORD, LONG)
  672.  
  673.     PURPOSE: Initializes window data and registers window class
  674.  
  675. ****************************************************************************/
  676.  
  677. BOOL FAR PASCAL SelectExtended(hDlg, message, wParam, lParam)
  678. HWND hDlg;
  679. unsigned message;
  680. WORD wParam;
  681. LONG lParam;
  682. {
  683.    char temp[80];
  684.    int i, j, k;
  685.    extern    int    finattract;    /* finite attractor switch */
  686.    extern    double    potparam[3];    /* three potential parameters*/
  687.    extern    int    pot16bit;
  688.    extern    int    usr_distest;    /* distance estimator option */
  689.    extern    int    distestwidth;
  690.    extern    int    rotate_lo,rotate_hi;
  691.  
  692.     switch (message) {
  693.  
  694.         case WM_INITDIALOG:
  695.             if (finattract)
  696.                 win_temp1 = 1;
  697.             else
  698.                 win_temp1 = 0;
  699.             CheckDlgButton(hDlg, ID_FINITE, win_temp1);
  700.             sprintf(temp,"%f",potparam[0]);
  701.         SetDlgItemText(hDlg, ID_POTENTMAX, temp);
  702.             sprintf(temp,"%f",potparam[1]);
  703.         SetDlgItemText(hDlg, ID_POTENTSLOPE, temp);
  704.             sprintf(temp,"%f",potparam[2]);
  705.         SetDlgItemText(hDlg, ID_POTENTBAIL, temp);
  706.             if (pot16bit)
  707.                 win_temp2 = 1;
  708.             else
  709.                 win_temp2 = 0;
  710.             CheckDlgButton(hDlg, ID_POTENT16, win_temp2);
  711.             sprintf(temp,"%i",usr_distest);
  712.         SetDlgItemText(hDlg, ID_DISTEST, temp);
  713.             sprintf(temp,"%i",distestwidth);
  714.         SetDlgItemText(hDlg, ID_DISTESTWID, temp);
  715.             for (i = 0; i < 3; i++) {
  716.                 sprintf(temp,"%.12f",inversion[i]);
  717.                 if (inversion[i] == AUTOINVERT)
  718.                 SetDlgItemText(hDlg, ID_INVERTRAD+i, "auto");
  719.                 else
  720.                 SetDlgItemText(hDlg, ID_INVERTRAD+i, temp);
  721.             }
  722.             sprintf(temp,"%i",rotate_lo);
  723.         SetDlgItemText(hDlg, ID_COLORMIN, temp);
  724.             sprintf(temp,"%i",rotate_hi);
  725.         SetDlgItemText(hDlg, ID_COLORMAX, temp);
  726.             win_oldprompts[0] = win_temp1;
  727.             win_oldprompts[1] = potparam[0];
  728.             win_oldprompts[2] = potparam[1];
  729.             win_oldprompts[3] = potparam[2];
  730.             win_oldprompts[4] = win_temp2;
  731.             win_oldprompts[5] = usr_distest;
  732.             win_oldprompts[6] = distestwidth;
  733.             win_oldprompts[7] = inversion[0];
  734.             win_oldprompts[8] = inversion[1];
  735.             win_oldprompts[9] = inversion[2];
  736.             return (TRUE);
  737.  
  738.         case WM_COMMAND:
  739.             switch (wParam) {
  740.  
  741.                 case IDOK:
  742.                     /* retrieve and validate the results */
  743.                     finattract = win_temp1;
  744.                     GetDlgItemText(hDlg, ID_POTENTMAX, temp, 10);
  745.                     potparam[0] = atof(temp);
  746.                     GetDlgItemText(hDlg, ID_POTENTSLOPE, temp, 10);
  747.                     potparam[1] = atof(temp);
  748.                     GetDlgItemText(hDlg, ID_POTENTBAIL, temp, 10);
  749.                     potparam[2] = atof(temp);
  750.                     pot16bit = win_temp2;
  751.                     GetDlgItemText(hDlg, ID_DISTEST, temp, 10);
  752.                     usr_distest = atoi(temp);
  753.                     GetDlgItemText(hDlg, ID_DISTESTWID, temp, 10);
  754.                     distestwidth = atoi(temp);
  755.                     for (i = 0; i < 3; i++) {
  756.                         GetDlgItemText(hDlg, ID_INVERTRAD+i, temp, 20);
  757.                         if (temp[0] == 'a' || temp[0] == 'A')
  758.                             inversion[i] = AUTOINVERT;
  759.                         else
  760.                             inversion[i] = atof(temp);
  761.                         }
  762.                     invert = (inversion[0] == 0.0) ? 0 : 3;
  763.                     GetDlgItemText(hDlg, ID_COLORMIN, temp, 10);
  764.                     rotate_lo = atoi(temp);
  765.                     GetDlgItemText(hDlg, ID_COLORMAX, temp, 10);
  766.                     rotate_hi = atoi(temp);
  767.                     if (rotate_lo < 0 || rotate_hi > 255 || rotate_lo > rotate_hi) {
  768.                         rotate_lo = 0;
  769.                         rotate_hi = 255;
  770.                         }
  771.                     time_to_restart = 0;
  772.                     if (
  773.                         win_oldprompts[0] != win_temp1   ||
  774.                         win_oldprompts[1] != potparam[0]  ||
  775.                         win_oldprompts[2] != potparam[1]  ||
  776.                         win_oldprompts[3] != potparam[2]  ||
  777.                         win_oldprompts[4] != win_temp2    ||
  778.                         win_oldprompts[5] != usr_distest  ||
  779.                         win_oldprompts[6] != distestwidth ||
  780.                         win_oldprompts[7] != inversion[0] ||
  781.                         win_oldprompts[8] != inversion[1] ||
  782.                         win_oldprompts[9] != inversion[2]
  783.                         ) time_to_restart = 1;
  784.                     EndDialog(hDlg, time_to_restart);
  785.                     break;
  786.                   
  787.                 case IDCANCEL:
  788.                     EndDialog(hDlg, 0);
  789.                     break;
  790.  
  791.                 case ID_FINITE:
  792.                     if (win_temp1 == 0)
  793.                         win_temp1 = 1;
  794.                     else
  795.                         win_temp1 = 0;
  796.                     CheckDlgButton(hDlg, ID_FINITE, win_temp1);
  797.                     break;
  798.  
  799.                 case ID_POTENT16:
  800.                     if (win_temp2 == 0)
  801.                         win_temp2 = 1;
  802.                     else
  803.                         win_temp2 = 0;
  804.                     CheckDlgButton(hDlg, ID_POTENT16, win_temp2);
  805.                     break;
  806.  
  807.                 }
  808.         
  809.         }
  810.     return (FALSE);
  811. }
  812.  
  813. /****************************************************************************
  814.  
  815.     FUNCTION: SelectSavePar(HWND, unsigned, WORD, LONG)
  816.  
  817.     PURPOSE: Initializes window data and registers window class
  818.  
  819. ****************************************************************************/
  820.  
  821. BOOL FAR PASCAL SelectSavePar(hDlg, message, wParam, lParam)
  822. HWND hDlg;
  823. unsigned message;
  824. WORD wParam;
  825. LONG lParam;
  826. {
  827.    char temp[80];
  828.    int i, j, k;
  829.    extern int  colorstate;     /* comments in cmdfiles */
  830.    extern char CommandFile[];
  831.    extern char CommandName[];
  832.    extern char CommandComment1[];
  833.    extern char CommandComment2[];
  834.    extern char colorfile[];
  835.    extern int  colorstate;
  836.    extern    int    usr_distest;    /* distance estimator option */
  837.    extern int  potflag;            /* continuous potential flag */
  838.    extern    double    potparam[3];    /* three potential parameters*/
  839.  
  840.     switch (message) {
  841.  
  842.         case WM_INITDIALOG:
  843.             win_temp1 = 1;
  844.             if (colorstate == 1)
  845.                 win_temp1 = 1;
  846.             if (colorstate == 2)
  847.                 win_temp1 = 2;
  848.             win_temp2 = colors - 1;
  849.             if (maxiter < win_temp2) win_temp2 = maxiter;
  850.             if (inside  > 0 && inside    > win_temp2) win_temp2 = inside;
  851.             if (outside > 0 && outside   > win_temp2) win_temp2 = outside;
  852.             if (usr_distest < 0 && 0-usr_distest > win_temp2) win_temp2 = 0-usr_distest;
  853.             if (decomp > win_temp2) win_temp2 = decomp - 1;
  854.             if (potflag && potparam[0] >= win_temp2) win_temp2 = potparam[0];
  855.             if (++win_temp2 > 256) win_temp2 = 256;
  856.         SetDlgItemText(hDlg, ID_PFILE, CommandFile);
  857.         SetDlgItemText(hDlg, ID_PENTRY, CommandName);
  858.         if (CommandName[0] == 0)
  859.             SetDlgItemText(hDlg, ID_PENTRY, "test");
  860.         SetDlgItemText(hDlg, ID_PCOM1, CommandComment1);
  861.         SetDlgItemText(hDlg, ID_PCOM2, CommandComment2);
  862.             CheckDlgButton(hDlg, ID_PCOL1+win_temp1, 1);
  863.             sprintf(temp,"%i",win_temp2);
  864.         SetDlgItemText(hDlg, ID_PCNUM, temp);
  865.         if (colorstate == 2)
  866.             SetDlgItemText(hDlg, ID_PCFILE, colorfile);
  867.             return (TRUE);
  868.  
  869.         case WM_COMMAND:
  870.             switch (wParam) {
  871.  
  872.                 case IDOK:
  873.                     /* retrieve and validate the results */
  874.                     GetDlgItemText(hDlg, ID_PFILE, CommandFile,     50);
  875.                     GetDlgItemText(hDlg, ID_PENTRY, CommandName,    50);
  876.                     GetDlgItemText(hDlg, ID_PCOM1, CommandComment1, 50);
  877.                     GetDlgItemText(hDlg, ID_PCOM2, CommandComment2, 50);
  878.                     GetDlgItemText(hDlg, ID_PCFILE, colorfile,      50);
  879.                     EndDialog(hDlg, 1);
  880.                     break;
  881.                   
  882.                 case IDCANCEL:
  883.                     EndDialog(hDlg, 0);
  884.                     break;
  885.  
  886.                 case ID_PCOL1:
  887.                 case ID_PCOL2:
  888.                 case ID_PCOL3:
  889.                     win_temp1 = wParam - ID_PCOL1;
  890.                     CheckRadioButton(hDlg, ID_PCOL1, ID_PCOL3, wParam);
  891.                 }
  892.         
  893.         }
  894.     return (FALSE);
  895. }
  896.  
  897. /****************************************************************************
  898.  
  899.     FUNCTION: SelectCycle(HWND, unsigned, WORD, LONG)
  900.  
  901.     PURPOSE: Initializes window data and registers window class
  902.  
  903. ****************************************************************************/
  904.  
  905.  
  906. int win_cycledir = -1, win_cyclerand = 0, win_cyclefreq = 0, win_cycledelay = 0;
  907. int win_tempcycle, win_tempcycledir, win_tempcyclerand, win_tempcyclefreq;
  908.  
  909. BOOL FAR PASCAL SelectCycle(hDlg, message, wParam, lParam)
  910. HWND hDlg;
  911. unsigned message;
  912. WORD wParam;
  913. LONG lParam;
  914. {
  915.     switch (message) {
  916.  
  917.         case WM_INITDIALOG:
  918.             win_tempcycle = time_to_cycle;
  919.             win_tempcycledir = win_cycledir;
  920.             win_tempcyclerand = win_cyclerand;
  921.             win_tempcyclefreq = win_cyclefreq;
  922.             if (win_tempcycle == 0)
  923.                 CheckDlgButton(hDlg, ID_CYCLEOFF, 1);
  924.             else
  925.                 CheckDlgButton(hDlg, ID_CYCLEON, 1);
  926.             if (win_tempcycledir == -1)
  927.                 CheckDlgButton(hDlg, ID_CYCLEOUT, 1);
  928.             else
  929.                 CheckDlgButton(hDlg, ID_CYCLEIN, 1);
  930.             if (win_tempcyclerand == 0)
  931.                 CheckDlgButton(hDlg, ID_CYCLESTAT, 1);
  932.             else
  933.                 CheckDlgButton(hDlg, ID_CYCLECHG, 1);
  934.             if (win_tempcyclefreq == 0)
  935.                 CheckDlgButton(hDlg, ID_CYCLELOW, 1);
  936.             else if (win_tempcyclefreq == 1)
  937.                 CheckDlgButton(hDlg, ID_CYCLEMED, 1);
  938.             else
  939.                 CheckDlgButton(hDlg, ID_CYCLEHIGH, 1);
  940.             return (TRUE);
  941.  
  942.         case WM_COMMAND:
  943.             switch (wParam) {
  944.  
  945.                 case IDOK:
  946.                     /* retrieve and validate the results */
  947.                     time_to_cycle = win_tempcycle;
  948.                     win_cycledir = win_tempcycledir;
  949.                     win_cyclerand = win_tempcyclerand;
  950.                     win_cyclefreq = win_tempcyclefreq;
  951.                     EndDialog(hDlg, 1);
  952.                     break;
  953.                   
  954.                 case IDCANCEL:
  955.                     EndDialog(hDlg, 0);
  956.                     break;
  957.  
  958.                 case ID_CYCLEOFF:
  959.                     win_tempcycle = 0;
  960.                     CheckRadioButton(hDlg, ID_CYCLEOFF, ID_CYCLEON, ID_CYCLEOFF);
  961.                     break;
  962.  
  963.                 case ID_CYCLEON:
  964.                     win_tempcycle = 1;
  965.                     CheckRadioButton(hDlg, ID_CYCLEOFF, ID_CYCLEON, ID_CYCLEON);
  966.                     break;
  967.  
  968.                 case ID_CYCLEOUT:
  969.                     win_tempcycledir = -1;
  970.                     CheckRadioButton(hDlg, ID_CYCLEOUT, ID_CYCLEIN, ID_CYCLEOUT);
  971.                     break;
  972.  
  973.                 case ID_CYCLEIN:
  974.                     win_tempcycledir = 1;
  975.                     CheckRadioButton(hDlg, ID_CYCLEOUT, ID_CYCLEIN, ID_CYCLEIN);
  976.                     break;
  977.  
  978.                 case ID_CYCLESTAT:
  979.                     win_tempcyclerand = 0;
  980.                     CheckRadioButton(hDlg, ID_CYCLESTAT, ID_CYCLECHG, ID_CYCLESTAT);
  981.                     break;
  982.  
  983.                 case ID_CYCLECHG:
  984.                     win_tempcyclerand = 1;
  985.                     CheckRadioButton(hDlg, ID_CYCLESTAT, ID_CYCLECHG, ID_CYCLECHG);
  986.                     break;
  987.  
  988.                 case ID_CYCLELOW:
  989.                     win_tempcyclefreq = 0;
  990.                     CheckRadioButton(hDlg, ID_CYCLELOW, ID_CYCLEHIGH, ID_CYCLELOW);
  991.                     break;
  992.  
  993.                 case ID_CYCLEMED:
  994.                     win_tempcyclefreq = 1;
  995.                     CheckRadioButton(hDlg, ID_CYCLELOW, ID_CYCLEHIGH, ID_CYCLEMED);
  996.                     break;
  997.  
  998.                 case ID_CYCLEHIGH:
  999.                     win_tempcyclefreq = 2;
  1000.                     CheckRadioButton(hDlg, ID_CYCLELOW, ID_CYCLEHIGH, ID_CYCLEHIGH);
  1001.                     break;
  1002.  
  1003.                 }
  1004.         
  1005.         }
  1006.     return (FALSE);
  1007. }
  1008.  
  1009. FARPROC lpSelectFullScreen;
  1010.  
  1011. extern HANDLE hInst;
  1012.  
  1013. int win_fullscreen_count;
  1014. char * far win_fullscreen_prompts[20];
  1015. char *win_fullscreen_heading;
  1016. static struct fullscreenvalues win_fullscreen_values[20];
  1017.  
  1018. int xxx_fullscreen_prompt(    /* full-screen prompting routine */
  1019.     char *hdg,        /* heading, lines separated by \n */
  1020.     int numprompts,     /* there are this many prompts (max) */
  1021.     char * far *prompts,    /* array of prompting pointers */
  1022.     struct fullscreenvalues values[], /* array of values */
  1023.     int options,        /* future use bits in case we need them */
  1024.     int fkeymask        /* bit n on if Fn to cause return */
  1025.     )
  1026. {
  1027. int i;
  1028. int Return;
  1029.  
  1030. win_fullscreen_count = numprompts;
  1031. win_fullscreen_heading = hdg;
  1032. win_fullscreen_count = numprompts;
  1033. for (i = 0; i < win_fullscreen_count; i++) {
  1034.    win_fullscreen_prompts[i] = prompts[i]; 
  1035.    win_fullscreen_values[i]  = values[i];
  1036.    }
  1037.  
  1038. lpSelectFullScreen = MakeProcInstance(SelectFullScreen, hInst);
  1039. Return = DialogBox(hInst, "SelectFullScreen", hwnd, lpSelectFullScreen);
  1040. FreeProcInstance(lpSelectFullScreen);
  1041.  
  1042. if (Return) {
  1043.     for (i = 0; i < win_fullscreen_count; i++) {
  1044.         values[i] = win_fullscreen_values[i];
  1045.     }
  1046.     return(0);
  1047.     }
  1048.  
  1049. return(-1);
  1050. }
  1051.  
  1052. BOOL FAR PASCAL SelectFullScreen(hDlg, message, wParam, lParam)
  1053. HWND hDlg;
  1054. unsigned message;
  1055. WORD wParam;
  1056. LONG lParam;
  1057. {
  1058.  
  1059.     int i;
  1060.     char temp[80];
  1061.  
  1062.     switch (message) {
  1063.  
  1064.         case WM_INITDIALOG:
  1065.             SetDlgItemText(hDlg, ID_PROMPT00,win_fullscreen_heading);
  1066.             for (i = 0; i < win_fullscreen_count; i++) {
  1067.                 SetDlgItemText(hDlg, ID_PROMPT01+i,win_fullscreen_prompts[i]);
  1068.                 if (win_fullscreen_values[i].type == 'd' ||
  1069.                     win_fullscreen_values[i].type == 'f')
  1070.                     sprintf(temp,"%10.5f",win_fullscreen_values[i].uval.dval);
  1071.                 else if(win_fullscreen_values[i].type == 'i')
  1072.                     sprintf(temp,"%d",win_fullscreen_values[i].uval.ival);
  1073.                 else if(win_fullscreen_values[i].type == 's')
  1074.                 {
  1075.                     strncpy(temp,win_fullscreen_values[i].uval.sval,16);
  1076.                     temp[15] = 0;
  1077.                 }
  1078.                 else if(win_fullscreen_values[i].type == 'l')
  1079.                     strcpy(temp,win_fullscreen_values[i].uval.ch.list[win_fullscreen_values[i].uval.ch.val]);
  1080.                 else
  1081.                     strcpy(temp,win_fullscreen_values[i].uval.sval);
  1082.                 SetDlgItemText(hDlg, ID_ANSWER01+i,temp);
  1083.                 }
  1084.             return (TRUE);
  1085.  
  1086.         case WM_COMMAND:
  1087.             switch (wParam) {
  1088.  
  1089.                 case IDOK:
  1090.                     for (i = 0; i < win_fullscreen_count; i++) {
  1091.                         GetDlgItemText(hDlg, ID_ANSWER01+i , temp, 20);
  1092.                         if (win_fullscreen_values[i].type == 'd' ||
  1093.                             win_fullscreen_values[i].type == 'f')
  1094.                             win_fullscreen_values[i].uval.dval = atof(temp);
  1095.                         else if(win_fullscreen_values[i].type == 'i')
  1096.                             win_fullscreen_values[i].uval.ival = atoi(temp);
  1097.                         else if(win_fullscreen_values[i].type == 's')
  1098.                             strncpy(win_fullscreen_values[i].uval.sval,temp,16);
  1099.                         else if(win_fullscreen_values[i].type == 'l')
  1100.                             strcpy(win_fullscreen_values[i].uval.ch.list[win_fullscreen_values[i].uval.ch.val],temp);
  1101.                         else
  1102.                             strcpy(win_fullscreen_values[i].uval.sval,temp);
  1103.                     }
  1104.                     EndDialog(hDlg, 1);
  1105.                     break;
  1106.                   
  1107.                 case IDCANCEL:
  1108.                     EndDialog(hDlg, 0);
  1109.                     break;
  1110.  
  1111.                 }
  1112.         
  1113.         }
  1114.     return (FALSE);
  1115. }
  1116.  
  1117.  
  1118. extern int init3d[];
  1119. extern int win_3dspherical;
  1120. extern char preview, showbox;
  1121. extern int previewfactor, glassestype, whichimage;
  1122. extern int xtrans, ytrans, transparent[2], RANDOMIZE;
  1123. extern int red_crop_left, red_crop_right;
  1124. extern int blue_crop_left, blue_crop_right;
  1125. extern int red_bright, blue_bright;
  1126. extern    int RAY;
  1127. extern    int BRIEF;
  1128. extern    int Ambient;
  1129. extern    char ray_name[];
  1130. extern int Targa_Overlay;
  1131. extern int Targa_Out;
  1132. extern    int    overlay3d;        /* 3D overlay flag: 0 = OFF */
  1133. extern int xadjust;
  1134. extern int eyeseparation;
  1135.  
  1136. static int far win_answers[20];
  1137.  
  1138. BOOL FAR PASCAL Select3D(hDlg, message, wParam, lParam)
  1139. HWND hDlg;
  1140. unsigned message;
  1141. WORD wParam;
  1142. LONG lParam;
  1143. {
  1144.  
  1145.     int i;
  1146.     char temp[80];
  1147.  
  1148.     switch (message) {
  1149.  
  1150.         case WM_INITDIALOG:
  1151.             win_answers[0] = preview;
  1152.             win_answers[1] = showbox;
  1153.             win_answers[2] = SPHERE;
  1154.             win_answers[3] = previewfactor;
  1155.             win_answers[4] = glassestype;
  1156.             win_answers[5] = FILLTYPE+1;
  1157.             win_answers[6] = RAY;
  1158.             win_answers[7] = BRIEF;
  1159.             win_answers[8] = Targa_Out;
  1160.             CheckDlgButton(hDlg, ID_PREVIEW, win_answers[0]);
  1161.             CheckDlgButton(hDlg, ID_SHOWBOX, win_answers[1]);
  1162.             CheckDlgButton(hDlg, ID_SPHERICAL, win_answers[2]);
  1163.             CheckDlgButton(hDlg, ID_RAYB, win_answers[7]);
  1164. /*
  1165.             CheckDlgButton(hDlg, ID_TARGA, win_answers[8]);
  1166. */
  1167.             sprintf(temp,"%d",win_answers[3]);
  1168.         SetDlgItemText(hDlg, ID_PREVIEWFACTOR, temp);
  1169.             CheckRadioButton(hDlg, ID_STEREO1, ID_STEREO4,
  1170.                 ID_STEREO1+win_answers[4]);
  1171.             CheckRadioButton(hDlg, ID_FILL1, ID_FILL8,
  1172.                 ID_FILL1+win_answers[5]);
  1173.             CheckRadioButton(hDlg, ID_RAY0, ID_RAY6,
  1174.                 ID_RAY0+win_answers[6]);
  1175.             check_writefile(ray_name,".ray");
  1176.         SetDlgItemText(hDlg, ID_RAYN, ray_name);
  1177.             return (TRUE);
  1178.  
  1179.         case WM_COMMAND:
  1180.             switch (wParam) {
  1181.  
  1182.                 case IDOK:
  1183.                     if(win_answers[2] != SPHERE) {
  1184.                         SPHERE = win_answers[2];
  1185.                         set_3d_defaults();
  1186.                         }
  1187.                     preview = win_answers[0];
  1188.                     showbox = win_answers[1];
  1189.                     SPHERE  = win_answers[2];
  1190.                     RAY     = win_answers[6];
  1191.                     BRIEF   = win_answers[7];
  1192.                     Targa_Out = win_answers[8];
  1193.                     GetDlgItemText(hDlg, ID_PREVIEWFACTOR, temp, 10);
  1194.                     GetDlgItemText(hDlg, ID_RAYN, temp, 30);
  1195.                     strcpy(ray_name, temp);
  1196.                     previewfactor = atoi(temp);
  1197.                     glassestype = win_answers[4];
  1198.                     FILLTYPE = win_answers[5]-1;
  1199.                     win_3dspherical = SPHERE;
  1200.                     if(previewfactor < 8)
  1201.                        previewfactor = 8;
  1202.                     if(previewfactor > 128)
  1203.                        previewfactor = 128;
  1204.                     if(glassestype < 0)
  1205.                        glassestype = 0;
  1206.                     if(glassestype > 3)
  1207.                        glassestype = 3;
  1208.                     whichimage = 0;
  1209.                     if(glassestype)
  1210.                        whichimage = 1;
  1211.                     if (Targa_Out && overlay3d)
  1212.                        Targa_Overlay = 1;
  1213.                     EndDialog(hDlg, 1);
  1214.                     break;
  1215.                     
  1216.                 case ID_PREVIEW:
  1217.                 case ID_SHOWBOX:
  1218.                 case ID_SPHERICAL:
  1219.                     i = wParam - ID_PREVIEW;
  1220.                     win_answers[i] = 1 - win_answers[i];
  1221.                     CheckDlgButton(hDlg, ID_PREVIEW + i, win_answers[i]);
  1222.                     break;
  1223.  
  1224.                 case ID_FILL1:
  1225.                 case ID_FILL2:
  1226.                 case ID_FILL3:
  1227.                 case ID_FILL4:
  1228.                 case ID_FILL5:
  1229.                 case ID_FILL6:
  1230.                 case ID_FILL7:
  1231.                 case ID_FILL8:
  1232.                     i = wParam - ID_FILL1;
  1233.                     win_answers[5] = i;
  1234.                     CheckRadioButton(hDlg, ID_FILL1, ID_FILL8,
  1235.                         ID_FILL1+win_answers[5]);
  1236.                     break;
  1237.  
  1238.                 case ID_STEREO1:
  1239.                 case ID_STEREO2:
  1240.                 case ID_STEREO3:
  1241.                 case ID_STEREO4:
  1242.                     i = wParam - ID_STEREO1;
  1243.                     win_answers[4] = i;
  1244.                     CheckRadioButton(hDlg, ID_STEREO1, ID_STEREO4,
  1245.                         ID_STEREO1+win_answers[4]);
  1246.                     break;
  1247.  
  1248.                 case ID_RAY0:
  1249.                 case ID_RAY1:
  1250.                 case ID_RAY2:
  1251.                 case ID_RAY3:
  1252.                 case ID_RAY4:
  1253.                 case ID_RAY5:
  1254.                 case ID_RAY6:
  1255.                     i = wParam - ID_RAY0;
  1256.                     win_answers[6] = i;
  1257.                     CheckRadioButton(hDlg, ID_RAY0, ID_RAY6,
  1258.                         ID_RAY0+win_answers[6]);
  1259.                     break;
  1260.  
  1261.                 case ID_RAYB:
  1262.                     win_answers[7] = 1 - win_answers[7];
  1263.                     CheckDlgButton(hDlg, ID_RAYB, win_answers[7]);
  1264.                     break;
  1265.  
  1266.                 case ID_TARGA:
  1267.                     win_answers[8] = 1 - win_answers[8];
  1268.                     CheckDlgButton(hDlg, ID_TARGA, win_answers[8]);
  1269.                     break;
  1270.  
  1271.                 case IDCANCEL:
  1272.                     EndDialog(hDlg, 0);
  1273.                     break;
  1274.  
  1275.                 }
  1276.         
  1277.         }
  1278.     return (FALSE);
  1279. }
  1280.  
  1281. BOOL FAR PASCAL Select3DPlanar(hDlg, message, wParam, lParam)
  1282. HWND hDlg;
  1283. unsigned message;
  1284. WORD wParam;
  1285. LONG lParam;
  1286. {
  1287.  
  1288.     int i;
  1289.     char temp[80];
  1290.  
  1291.     switch (message) {
  1292.  
  1293.         case WM_INITDIALOG:
  1294.             win_answers[0] = XROT;
  1295.             win_answers[1] = YROT;
  1296.             win_answers[2] = ZROT;
  1297.             win_answers[3] = XSCALE;
  1298.             win_answers[4] = YSCALE;
  1299.             win_answers[5] = ROUGH;
  1300.             win_answers[6] = WATERLINE;
  1301.             win_answers[7] = ZVIEWER;
  1302.             win_answers[8] = XSHIFT;
  1303.             win_answers[9] = YSHIFT;
  1304.             win_answers[10] = xtrans;
  1305.             win_answers[11] = ytrans;
  1306.             win_answers[12] = transparent[0];
  1307.             win_answers[13] = transparent[1];
  1308.             win_answers[14] = RANDOMIZE;
  1309.             for (i = 0; i < 15; i++) {
  1310.                 sprintf(temp,"%d", win_answers[i]);
  1311.                 SetDlgItemText(hDlg, ID_ANS1+i,temp);
  1312.                 }
  1313.             return (TRUE);
  1314.  
  1315.         case WM_COMMAND:
  1316.             switch (wParam) {
  1317.  
  1318.                 case IDOK:
  1319.                     for (i = 0; i < 15; i++) {
  1320.                         GetDlgItemText(hDlg, ID_ANS1+i, temp, 20);
  1321.                         win_answers[i] = atof(temp);
  1322.                         }
  1323.                     XROT =           win_answers[0];
  1324.                     YROT =           win_answers[1];
  1325.                     ZROT =           win_answers[2];
  1326.                     XSCALE =         win_answers[3];
  1327.                     YSCALE =         win_answers[4];
  1328.                     ROUGH =          win_answers[5];
  1329.                     WATERLINE =      win_answers[6];
  1330.                     ZVIEWER =        win_answers[7];
  1331.                     XSHIFT =         win_answers[8];
  1332.                     YSHIFT =         win_answers[9];
  1333.                     xtrans =         win_answers[10];
  1334.                     ytrans =         win_answers[11];
  1335.                     transparent[0] = win_answers[12];
  1336.                     transparent[1] = win_answers[13];
  1337.                     RANDOMIZE =      win_answers[14];
  1338.                     if (RANDOMIZE >= 7) RANDOMIZE = 7;
  1339.                     if (RANDOMIZE <= 0) RANDOMIZE = 0;
  1340.                     EndDialog(hDlg, 1);
  1341.                     break;
  1342.                   
  1343.                 case IDCANCEL:
  1344.                     EndDialog(hDlg, 0);
  1345.                     break;
  1346.  
  1347.                 }
  1348.         
  1349.         }
  1350.     return (FALSE);
  1351. }
  1352.  
  1353.  
  1354. BOOL FAR PASCAL SelectIFS3D(hDlg, message, wParam, lParam)
  1355. HWND hDlg;
  1356. unsigned message;
  1357. WORD wParam;
  1358. LONG lParam;
  1359. {
  1360.  
  1361.     int i, numanswers;
  1362.     char temp[80];
  1363.  
  1364.     numanswers = 5;
  1365.  
  1366.     switch (message) {
  1367.  
  1368.         case WM_INITDIALOG:
  1369.             win_answers[0] = XROT;
  1370.             win_answers[1] = YROT;
  1371.             win_answers[2] = ZROT;
  1372.             win_answers[3] = ZVIEWER;
  1373.             win_answers[4] = XSHIFT;
  1374.             win_answers[5] = YSHIFT;
  1375.             win_answers[6] = glassestype;
  1376.             for (i = 0; i <= numanswers; i++) {
  1377.                 sprintf(temp,"%d", win_answers[i]);
  1378.                 SetDlgItemText(hDlg, ID_ANS1+i,temp);
  1379.                 }
  1380.             CheckRadioButton(hDlg, ID_STEREO1, ID_STEREO4,
  1381.                 ID_STEREO1+win_answers[6]);
  1382.             return (TRUE);
  1383.  
  1384.         case WM_COMMAND:
  1385.             switch (wParam) {
  1386.  
  1387.                 case ID_STEREO1:
  1388.                 case ID_STEREO2:
  1389.                 case ID_STEREO3:
  1390.                 case ID_STEREO4:
  1391.                     i = wParam - ID_STEREO1;
  1392.                     win_answers[6] = i;
  1393.                     CheckRadioButton(hDlg, ID_STEREO1, ID_STEREO4,
  1394.                         ID_STEREO1+win_answers[6]);
  1395.                     break;
  1396.  
  1397.                 case IDOK:
  1398.                     for (i = 0; i <= numanswers; i++) {
  1399.                         GetDlgItemText(hDlg, ID_ANS1+i, temp, 20);
  1400.                         win_answers[i] = atof(temp);
  1401.                         }
  1402.                     XROT =           win_answers[0];
  1403.                     YROT =           win_answers[1];
  1404.                     ZROT =           win_answers[2];
  1405.                     ZVIEWER =        win_answers[3];
  1406.                     XSHIFT =         win_answers[4];
  1407.                     YSHIFT =         win_answers[5];
  1408.                     glassestype =    win_answers[6];
  1409.                     EndDialog(hDlg, 1);
  1410.                     break;
  1411.                   
  1412.                 case IDCANCEL:
  1413.                     EndDialog(hDlg, 0);
  1414.                     break;
  1415.  
  1416.                 }
  1417.         
  1418.         }
  1419.     return (FALSE);
  1420. }
  1421.  
  1422. char win_funnyglasses_map_name[41];
  1423.  
  1424. BOOL FAR PASCAL SelectFunnyGlasses(hDlg, message, wParam, lParam)
  1425. HWND hDlg;
  1426. unsigned message;
  1427. WORD wParam;
  1428. LONG lParam;
  1429. {
  1430.  
  1431.     int i, numanswers;
  1432.     char temp[80];
  1433.  
  1434.     numanswers = 7;
  1435.  
  1436.     switch (message) {
  1437.  
  1438.         case WM_INITDIALOG:
  1439.  
  1440.         /* defaults */
  1441.             if(ZVIEWER == 0)
  1442.                ZVIEWER = 150;
  1443.             if(eyeseparation == 0) {
  1444.                if(fractype==IFS3D || fractype==LLORENZ3D || fractype==FPLORENZ3D) {
  1445.                    eyeseparation =  2;
  1446.               xadjust       = -2;
  1447.                   }
  1448.                else {
  1449.               eyeseparation =  3;
  1450.               xadjust       =  0;
  1451.                   }
  1452.                }
  1453.  
  1454.             win_funnyglasses_map_name[0] = 0;
  1455.             if(glassestype == 1)
  1456.                 strcpy(win_funnyglasses_map_name,"glasses1.map");
  1457.             else if(glassestype == 2) {
  1458.                 if(FILLTYPE == -1)
  1459.                      strcpy(win_funnyglasses_map_name,"grid.map");
  1460.                 else
  1461.                 strcpy(win_funnyglasses_map_name,"glasses2.map");
  1462.                 }
  1463.  
  1464.             win_answers[0] = eyeseparation;
  1465.             win_answers[1] = xadjust;
  1466.             win_answers[2] = red_crop_left;
  1467.             win_answers[3] = red_crop_right;
  1468.             win_answers[4] = blue_crop_left;
  1469.             win_answers[5] = blue_crop_right;
  1470.             win_answers[6] = red_bright;
  1471.             win_answers[7] = blue_bright;
  1472.             for (i = 0; i < numanswers+1;i++) {
  1473.                 sprintf(temp,"%d", win_answers[i]);
  1474.                 SetDlgItemText(hDlg, ID_ANS1+i,temp);
  1475.                 }
  1476.             SetDlgItemText(hDlg, ID_ANS9,win_funnyglasses_map_name);
  1477.             return (TRUE);
  1478.  
  1479.         case WM_COMMAND:
  1480.             switch (wParam) {
  1481.  
  1482.                 case IDOK:
  1483.                     for (i = 0; i < numanswers+1; i++) {
  1484.                         GetDlgItemText(hDlg, ID_ANS1+i, temp, 20);
  1485.                         win_answers[i] = atof(temp);
  1486.                         }
  1487.                     GetDlgItemText(hDlg, ID_ANS9, temp, 40);
  1488.                     strcpy(win_funnyglasses_map_name, temp);
  1489.                     eyeseparation   =  win_answers[0];
  1490.                     xadjust         =  win_answers[1];
  1491.                     red_crop_left   =  win_answers[2];
  1492.                     red_crop_right  =  win_answers[3];
  1493.                     blue_crop_left  =  win_answers[4];
  1494.                     blue_crop_right =  win_answers[5];
  1495.                     red_bright      =  win_answers[6];
  1496.                     blue_bright     =  win_answers[7];
  1497.                     EndDialog(hDlg, 1);
  1498.                     break;
  1499.                   
  1500.                 case IDCANCEL:
  1501.                     EndDialog(hDlg, 0);
  1502.                     break;
  1503.  
  1504.                 }
  1505.         
  1506.         }
  1507.     return (FALSE);
  1508. }
  1509.  
  1510. BOOL FAR PASCAL SelectLightSource(hDlg, message, wParam, lParam)
  1511. HWND hDlg;
  1512. unsigned message;
  1513. WORD wParam;
  1514. LONG lParam;
  1515. {
  1516.  
  1517.     int i, numanswers;
  1518.     char temp[80];
  1519.  
  1520.     numanswers = 5;
  1521.  
  1522.     switch (message) {
  1523.  
  1524.         case WM_INITDIALOG:
  1525.             win_answers[0] = XLIGHT;
  1526.             win_answers[1] = YLIGHT;
  1527.             win_answers[2] = ZLIGHT;
  1528.             win_answers[3] = LIGHTAVG;
  1529.             win_answers[4] = Ambient;
  1530.             for (i = 0; i < numanswers+1;i++) {
  1531.                 sprintf(temp,"%d", win_answers[i]);
  1532.                 SetDlgItemText(hDlg, ID_ANS1+i,temp);
  1533.                 }
  1534.             return (TRUE);
  1535.  
  1536.         case WM_COMMAND:
  1537.             switch (wParam) {
  1538.  
  1539.                 case IDOK:
  1540.                     for (i = 0; i < numanswers+1; i++) {
  1541.                         GetDlgItemText(hDlg, ID_ANS1+i, temp, 20);
  1542.                         win_answers[i] = atof(temp);
  1543.                         }
  1544.                     XLIGHT   =  win_answers[0];
  1545.                     YLIGHT   =  win_answers[1];
  1546.                     ZLIGHT   =  win_answers[2];
  1547.                     LIGHTAVG =  win_answers[3];
  1548.                     Ambient  =  win_answers[4];
  1549.                     EndDialog(hDlg, 1);
  1550.                     break;
  1551.                   
  1552.                 case IDCANCEL:
  1553.                     EndDialog(hDlg, 0);
  1554.                     break;
  1555.  
  1556.                 }
  1557.         
  1558.         }
  1559.     return (FALSE);
  1560. }
  1561.  
  1562. BOOL FAR PASCAL Select3DSpherical(hDlg, message, wParam, lParam)
  1563. HWND hDlg;
  1564. unsigned message;
  1565. WORD wParam;
  1566. LONG lParam;
  1567. {
  1568.  
  1569.     int i;
  1570.     char temp[80];
  1571.  
  1572.     switch (message) {
  1573.  
  1574.         case WM_INITDIALOG:
  1575.             win_answers[0] = XROT;
  1576.             win_answers[1] = YROT;
  1577.             win_answers[2] = ZROT;
  1578.             win_answers[3] = XSCALE;
  1579.             win_answers[4] = YSCALE;
  1580.             win_answers[5] = ROUGH;
  1581.             win_answers[6] = WATERLINE;
  1582.             win_answers[7] = ZVIEWER;
  1583.             win_answers[8] = XSHIFT;
  1584.             win_answers[9] = YSHIFT;
  1585.             win_answers[10] = xtrans;
  1586.             win_answers[11] = ytrans;
  1587.             win_answers[12] = transparent[0];
  1588.             win_answers[13] = transparent[1];
  1589.             win_answers[14] = RANDOMIZE;
  1590.             for (i = 0; i < 15; i++) {
  1591.                 sprintf(temp,"%d", win_answers[i]);
  1592.                 SetDlgItemText(hDlg, ID_ANS1+i,temp);
  1593.                 }
  1594.             return (TRUE);
  1595.  
  1596.         case WM_COMMAND:
  1597.             switch (wParam) {
  1598.  
  1599.                 case IDOK:
  1600.                     for (i = 0; i < 15; i++) {
  1601.                         GetDlgItemText(hDlg, ID_ANS1+i, temp, 10);
  1602.                         win_answers[i] = atof(temp);
  1603.                         }
  1604.                     XROT =           win_answers[0];
  1605.                     YROT =           win_answers[1];
  1606.                     ZROT =           win_answers[2];
  1607.                     XSCALE =         win_answers[3];
  1608.                     YSCALE =         win_answers[4];
  1609.                     ROUGH =          win_answers[5];
  1610.                     WATERLINE =      win_answers[6];
  1611.                     ZVIEWER =        win_answers[7];
  1612.                     XSHIFT =         win_answers[8];
  1613.                     YSHIFT =         win_answers[9];
  1614.                     xtrans =         win_answers[10];
  1615.                     ytrans =         win_answers[11];
  1616.                     transparent[0] = win_answers[12];
  1617.                     transparent[1] = win_answers[13];
  1618.                     RANDOMIZE =      win_answers[14];
  1619.                     if (RANDOMIZE >= 7) RANDOMIZE = 7;
  1620.                     if (RANDOMIZE <= 0) RANDOMIZE = 0;
  1621.                     EndDialog(hDlg, 1);
  1622.                     break;
  1623.                   
  1624.                 case IDCANCEL:
  1625.                     EndDialog(hDlg, 0);
  1626.                     break;
  1627.  
  1628.                 }
  1629.         
  1630.         }
  1631.     return (FALSE);
  1632. }
  1633.  
  1634. BOOL FAR PASCAL SelectStarfield(hDlg, message, wParam, lParam)
  1635. HWND hDlg;
  1636. unsigned message;
  1637. WORD wParam;
  1638. LONG lParam;
  1639. {
  1640. extern double starfield_values[4];
  1641.  
  1642.    switch (message) {
  1643.  
  1644.         case WM_INITDIALOG:
  1645.             SetDlgItemInt(hDlg, ID_NUMSTARS,   (int)starfield_values[0], FALSE);
  1646.             SetDlgItemInt(hDlg, ID_CLUMPINESS, (int)starfield_values[1], FALSE);
  1647.             SetDlgItemInt(hDlg, ID_DIMRATIO,   (int)starfield_values[2], FALSE);
  1648.             return (TRUE);
  1649.  
  1650.         case WM_COMMAND:
  1651.             switch (wParam) {
  1652.  
  1653.                 case IDOK:
  1654.                     starfield_values[0] = GetDlgItemInt(hDlg, ID_NUMSTARS,   NULL, FALSE);
  1655.                     starfield_values[1] = GetDlgItemInt(hDlg, ID_CLUMPINESS, NULL, FALSE);
  1656.                     starfield_values[2] = GetDlgItemInt(hDlg, ID_DIMRATIO,   NULL, FALSE);
  1657.                     EndDialog(hDlg, 1);
  1658.                     break;
  1659.                   
  1660.                 case IDCANCEL:
  1661.                     EndDialog(hDlg, 0);
  1662.                     break;
  1663.  
  1664.                 }
  1665.         
  1666.         }
  1667.     return (FALSE);
  1668. }
  1669.